/*
 * Miya.com Inc.
 * Copyright (c) 2004-2018 All Rights Reserved.
 */
package com.miya.erpmofa.common.lang.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang.StringUtils;

/**
 * 支付类型枚举类
 *
 * @author zhaowei
 * @version $Id: CommodityProStatusEnum.java, v 0.1 2018年01月02日 20:26 PM
 */
@SuppressWarnings("unused")
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum PayTypeEnum {

    ALIPAY("ALIPAY", "ALIPAY", "支付宝", "支付宝"),

    WECHAT("WECHAT", "WECHAT", "微信", "微信"),

    MIYACOUPON("MIYACOUPON","MIYACOUPON","米雅券","米雅券"),

    MIYAPAY("MIYAPAY", "MIYAPAY", "米雅支付", "米雅支付"),

    OTHER("OTHER", "OTHER", "其他", "其他"),;

    /**
     * 枚举编码
     */
    @Getter
    private final String code;

    /**
     * 英文名
     */
    @Getter
    private final String englishName;

    /**
     * 中文名
     */
    @Getter
    private final String chineseName;

    /**
     * 枚举描述信息
     */
    @Getter
    private final String description;

    /**
     * 根据编码查询枚举。
     *
     * @param code 编码。
     * @return 枚举。
     */
    public static PayTypeEnum getByCode(String code) {
        for (PayTypeEnum value : PayTypeEnum.values()) {
            if (StringUtils.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
